﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class NewsList : System.Web.UI.Page
{
    public string Category = "";
    int m_ColID = 0;
    protected void Page_Load(object sender, EventArgs e)
    {
        Category = Request.QueryString["ml"];
        if(string.IsNullOrEmpty(Category))
            Response.Redirect("~/index.aspx");
        if (!IsPostBack)
        {
            string sql = "SELECT News.ID, News.Title,News.EditDate,News.[Top] FROM News INNER JOIN Category ON News.Category = Category.ID WHERE (Category.Name = '" + Category + "') ORDER BY News.[Top] DESC, News.EditDate DESC";
            DataTable tb = WFNetLib.ADO.SQLServerOP.DataTableSQL(sql);
            GridView1.Columns[m_ColID].Visible = true;
            GridViewOperation.BindPagingGridView(GridView1, tb.DefaultView, 0);
            GridView1.Columns[m_ColID].Visible = false;
        }
    }
    public string GetTopImage(object dataItem)
    {
        Boolean IsTop = Convert.ToBoolean(DataBinder.Eval(dataItem, "Top").ToString());
        if (IsTop)
            return "<img src='images/top.gif' />";
        else
            return "";
    }
}